package tblModelMenu;


import java.util.ArrayList;

import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;

import daoDataFactory.DaoFactory;
import domijn.Menu;
import pnlBeheer.PnlMenuBeheer;


public class TMMenu implements TableModel {

	@SuppressWarnings("unused")
	private PnlMenuBeheer pnlMenuBeheer;
	private String []names = {"Naam"};
	private ArrayList<Menu> almenu;
	private Menu m;

	public TMMenu(PnlMenuBeheer pnlMenuBeheer) {
		this.pnlMenuBeheer = pnlMenuBeheer;
		almenu = DaoFactory.getwokapplicatie().getDaoIMenu().loadall();
	}




	@Override
	public int getRowCount() {
		return almenu.size();
	}

	@Override
	public int getColumnCount() {
		return names.length;
	}
	
	@Override
	public String getColumnName(int column) {
		return names[column];
	}

	@Override
	public Class<Menu> getColumnClass(int column) {
		return Menu.class;
	}

	@Override
	public boolean isCellEditable(int arg0, int arg1) {
		return false;
	}
	
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		m = almenu.get(rowIndex);
		 switch (columnIndex){

         case 0:
             return m.getMenuName();
            		 

     }
     return m;
 }
	
	@Override
	public void setValueAt(Object arg0, int arg1, int arg2) {
	}
	
	@Override
	public void addTableModelListener(TableModelListener arg0) {
	}
	
	@Override
	public void removeTableModelListener(TableModelListener arg0) {
	}



}
